<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'/>
    <title>Display a map</title>
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no'/>
    <script src='../assets/mapbox-gl-dev.js'></script>
    <script src='../assets/turf.js'></script>
    <link href='../assets/mapbox-gl.css' rel='stylesheet'/>
    <style>
        body {
            margin: 0;
            padding: 0;
        }

        #map {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 100%;
        }
    </style>
</head>
<body>

<div id='map'></div>
<script>
    window.onload = function () {
        mapboxgl.accessToken = 'pk.eyJ1IjoibWFvcmV5IiwiYSI6ImNqNWhrenIwcDFvbXUyd3I2bTJxYzZ4em8ifQ.KHZIehQuWW9AsMaGtATdwA';
        var map = new mapboxgl.Map({
            container: 'map', // container id
            center: [119.3517191, 34.6418364], // starting position [lng, lat]
            zoom: 15,
            style: 'mapbox://styles/mapbox/streets-v11', // stylesheet location
            // style: 'mapbox://styles/mapbox/satellite-v9'
        });

        map.on('load', function() {

            var center = [119.3517191, 34.6418364];
            var radius = 0.1;
            var options = {steps: 100, units: 'kilometers', properties: {foo: 'bar'}};
            var circle = turf.circle(center, radius, options);

            map.addLayer({
                "id": "point",
                "type": "symbol",
                "source": {
                    "type": "geojson",
                    "data": {
                        "type": "FeatureCollection",
                        "features": [{
                            "type": "Feature",
                            "geometry": {
                                "type": "Point",
                                "coordinates": [119.3517191, 34.6418364]
                            }
                        }]
                    }
                },
            });
            map.addLayer({
                "id": '123',
                "type": "fill",
                "source": {
                    "type": "geojson",
                    "data": circle
                },
                "paint": {
                    "fill-color": "#f00",
                    "fill-opacity": 0.5
                }
            });

        });
    };
</script>

</body>
</html>
